<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>tinyGameEngine</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/7.1.2/pixi.min.js"></script>
    <!-- <script src="https://pixijs.download/release/pixi.min.js"></script>   -->
</head>
<body>
    <!-- <canvas id="c"></canvas> -->
    <script src="tiny.js"></script>
    <!-- user code -->
    <script>
        const app = new PIXI.Application({
        width: 800,
        height: 600
    });
document.body.appendChild(app.view);

  // Magically load the PNG asynchronously
    const label = new Label("label")
    
    const sprite = new Sprite('assets/c01.png')
    app.stage.addChild(sprite);
    app.stage.addChild(label);  

     
  const button = new Button("默认") 

  app.stage.addChild(button);  
  const button2 = new Button("播放音乐测试") 
  button2.y = 100
  
  app.stage.addChild(button2);  
  button.on('pointerdown', () => {  
        console.log('Button pressed!');  
        // 你可以在这里添加按下按钮时的逻辑  
    });  
const audio = new AudioStreamPlayer("assets/cat.mp3")
audio.play()
  // Add a variable to count up the seconds our demo has been running
//   let elapsed = 0.0;
//   // 主循环
//   app.ticker.add((delta) => {
//     // Add the time to our total elapsed time
//     elapsed += delta;
//     // Update the sprite's X position based on the cosine of our elapsed time.  We divide
//     // by 50 to slow the animation down a bit...
//     sprite.x = 100.0 + Math.cos(elapsed/50.0) * 100.0;
//     // console.log(delta)
//   });
    </script>
</body>
</html>